package com.sdgakj.enums;

/**
 * Created by duronghong on 2016/9/2.
 */
public enum EnumRoleType {

    ROLE_ADMIN("admin", "超级管理员"),
    ROLE_DEALER_NORMAL("ROLE_DEALER_NORMAL", "无品牌二手车发布权限的经销商角色"),
    ROLE_DEALER_AUTH("ROLE_DEALER_AUTH", "有品牌二手发布权限的经销商角色"),
    ROLE_OUMAN("ROLE_OUMAN", "欧曼主机厂"),
    ROLE_SHANQI("ROLE_SHANQI", "陕西重汽"),
    ROLE_SHANQI_DEALER("ROLE_SHANQI_DEALER","陕汽经销商");
    private String code;
    private String name;

    EnumRoleType(String code, String name) {
        this.code = code;
        this.name = name;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public static EnumRoleType getEnum(String value) {
        for (EnumRoleType e : EnumRoleType.values()) {
            if (value.equals(e.getCode())) {
                return e;
            }
        }
        return ROLE_DEALER_NORMAL;
    }
}
